package com.woniu.controller;

import com.woniu.dto.RegisDto;
import com.woniu.service.RegistrationService;
import com.woniu.utils.ResponseUtil;
import com.woniu.entity.Registration;
import com.woniu.service.RegistrationService;
import com.woniu.utils.ResponseUtil;

import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @Author: zcy
 * @Create: 2025/10/29 17:04
 */
@RestController
@RequestMapping("/registration")
public class RegistrationController {
    @Resource
    private RegistrationService registrationService;
    /*
    * @Description: 获取所有患者挂号信息
     */
    @PostMapping("/find")
    public ResponseUtil findAll(@RequestBody RegisDto regisDto) {
        return registrationService.findAll(regisDto);
    }
    @PostMapping("/add")
    public ResponseUtil add(@RequestBody Registration registration) throws InterruptedException {
        return registrationService.add(registration);
    }
    @GetMapping("/findByNo/{rsNo}")
    public ResponseUtil findByNo(@PathVariable String rsNo){
        return registrationService.findByNo(rsNo);
    }
    //缴费
    @PostMapping("/pay/{rsNo}")
    public ResponseUtil update(@PathVariable String rsNo){
        return registrationService.pay(rsNo);
    }
    //退号
    @PostMapping("/tuiHao/{rsNo}")
    public ResponseUtil tuiHao(@PathVariable String rsNo){
        return registrationService.tuiHao(rsNo);
    }
    @GetMapping("/findByPatientId/{patientId}")
    public ResponseUtil findByPatientId(@PathVariable Integer patientId){
        return registrationService.findByPatientId(patientId);
    }
}
